<?php
/**
 * Created by PhpStorm.
 * User: Duck
 * Create time: 2016/12/21 9:56
 */

namespace D\Controller;
use Common\Controller\BaseController;

class FieldShowController extends BaseController{
    public function show(){
        $this->display();
    }
    public function getStu(){
        if(!empty($_POST['class'])){
            $where['class']=I('post.class');
        }
        if(!empty($_POST['sname'])){
            $where['sname']=I('post.sname');
        }
        $res=M('students')->field('student_id,sname,class')->where($where)->select();
        foreach($res as $k=>$v){
            $fie=M('filed')->where($v['student_id'])->select();
            $res[$k]['field']=$fie;
        }
        print_r($fie);
        $this->ajaxReturn($res);
    }
}